home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 1 / CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso / Aminet / misc / amag / AM9407_2.lha / Locale-Library / listing2.c < prev    next >
C/C++ Source or Header  |  1994-06-28  |  1KB  |  47 lines

  1. /* Dieses Programm liest die Systemkataloge aus
  2.  * Aufruf: programmname <sprache> katalog [katalog]
  3.  * Verwendeter C-Compiler: SAS-C 6.5x
  4.  */
  5. #include <exec/types.h>
  6. #include <proto/dos.h>
  7. #include <proto/exec.h>
  8. #include <proto/locale.h>
  9. #include <proto/utility.h>
  10.  
  11. #include <stdio.h>
  12. #include <string.h>
  13.  
  14. struct Library *LocaleBase=NULL;
  15. struct Catalog *mycatalog;
  16.  
  17. #define VERZEICHNIS "sys/"
  18. char CatalogName[100];
  19. VOID main(ULONG argc, char **argv)
  20. {
  21.   ULONG argus = 2;
  22.   if( argc ) {
  23.     LocaleBase=OpenLibrary("locale.library",38);
  24.     if( LocaleBase ) {
  25.       while( argus < argc)
  26.       {
  27.         strcpy(CatalogName,VERZEICHNIS);
  28.         strcat(CatalogName,argv[argus++]);
  29.         /* Katalog der gewünschten Sprache öffnen */
  30.         mycatalog=OpenCatalog(NULL,CatalogName,
  31.             OC_Language, (ULONG)argv[1], TAG_DONE);
  32.         if( mycatalog ) {
  33.           long nr = 0;
  34.           UBYTE *text;
  35.           printf("Kataloginhalt von %s\n",CatalogName);
  36.           while( (text=GetCatalogStr(mycatalog,nr,NULL)) 
  37.                  != NULL )
  38.             printf("String[%d]=\"%s\"\n",nr++,text);
  39.           CloseCatalog( mycatalog );
  40.         } else printf("Fehler beim Öffnen"
  41.                       " des Catalogs %s\n",CatalogName);
  42.       }
  43.       CloseLibrary(LocaleBase);
  44.     } else printf("Locale-Library nicht vorhanden\n");
  45.   }
  46. }
  47.